<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>清除浮动</title>
</head>
<style>
    .parent {
        background-color: red;
        overflow: hidden;
    }
    /* .parent::after {
        content: '';
        clear: both;
        display: block;
    } */
    .parent div {
        float: left;
    }
    .left {
        height: 200px;
        width: 200px;
        background-color: teal;
    }
    .right {
        height: 200px;
        width: 200px;
        background-color: yellow;
    }

</style>
<body>
    <div class="parent">
        <div class="left"></div>
        <div class="right"></div>
    </div>
</body>
</html>